<template>
	<view v-if="info.name" class="box" :style="theme">
		<!-- 轮播 -->
		<view class="banner">
			<!-- <image :src="info.imgUrlAll" mode="widthFix" style="width: 100%;"></image> -->
			<u-swiper :list="arr" indicator indicatorMode="dot" height="400rpx" keyName="url" circular></u-swiper>
		</view>
		<!-- 场馆信息 -->
		<view class="box_info">
			<view class="box_info_top">
				<view class="box_info_top_left">
					<text>{{info.name}}</text>
					<text>营业时间：{{info.openTimeStart}} ~ {{info.openTimeEnd}}</text>
				</view>
				<view class="box_info_top_right">
					<view v-if="info.telephone" class="box_info_top_right_k" @click="call(info.telephone)">
						<image :src="imgHost+'/ic_dianhua.png'"></image>
						<text>电话</text>
					</view>
					<view v-if="info.latitudeLongitude" class="box_info_top_right_k" @click="navigation">
						<image :src="imgHost+'/home_ic_location.png'"></image>
						<text>导航</text>
					</view>
				</view>
			</view>
			<view v-if="info.postion" class="box_info_button">
				<image class="box_switch_left_imga" :src="imgHost+'/home_ic_location.png'"
					style="width: 24rpx;height: 24rpx;margin-right:10rpx"></image>
				<text>{{info.postion}}</text>
			</view>
		</view>
		<view v-if="info.describe||(facilitiesList&&facilitiesList.length>0)" class="box_content">
			<view v-if="info.describe" class="box_title"><text></text>场馆简介</view>
			<view v-if="info.describe" class="mb3">
				<u-parse :content="info.describe"></u-parse>
			</view>
			<view v-if="facilitiesList&&facilitiesList.length>0" class="box_title"><text></text>场馆设施</view>
			<view v-if="facilitiesList&&facilitiesList.length>0" class="box_ss_list">
				<view class="box_ss_list_item" v-for="(item, index) in facilitiesList" :key="index">
					<image :src="item.configPicture"></image>
					<text>{{item.configName}}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				info: {},
				noClick: true,
				projectId: '',
				arr: [],
				facilitiesList: [],
				id: ''
			}
		},
		onLoad(ops) {
			this.id = ops.id
			this.projectId = ops.projectId
			this.getVenueInfo(ops.id)
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			navigation() {
				let data = this.info.latitudeLongitude.split(',')
				uni.openLocation({
					longitude: Number(data[0]),
					latitude: Number(data[1]),
					name: this.info.name,
					address: this.info.name,
					success() {
						console.log('success');
					}
				})
			},
			call(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
					success: function() {
						console.log('拨打电话成功');
					},
					fail() {
						console.log('打电话失败了');
					}
				})
			},
			// 获取场馆详细信息
			getVenueInfo(id) {
				this.$app.ajax({
					api: this.$api.getVenueInfo(),
					data: {
						param: {
							id
						}
					}
				}).then((res) => {
					if (res.errorCode === '000000') {
						let arr = []
						let facilitiesList = []
						if (res.record.showPictures) {
							var piclist = res.record.showPictures.split(',')
							for (let i = 0; i < piclist.length; i++) {
								let obj = {
									url: piclist[i]
								}
								arr.push(obj)
							}
						}
						if (res.record.facilitys && res.record.facilitys.length != 0) {

							for (let i = 0; i < res.record.facilitys.length; i++) {
								if (res.record.facilitys[i].isChosed == 1) {
									facilitiesList.push(res.record.facilitys[i])
								}
							}
						}
						this.facilitiesList = facilitiesList
						this.arr = arr
						this.info = res.record
					} else {
						setTimeout(()=> {
							uni.navigateBack({
								delta:1
							})
						}, 500)
					}
				}).catch(() => {})
			}

		}

	}
</script>
<style>
	page {
		background: #fff;
	}
</style>
<style scoped lang="scss">
	.box {
		padding-bottom: 150rpx;
	}

	.box_info {
		padding: 30rpx 30rpx;
		box-sizing: border-box;
		background-color: #fff;
	}

	.box_info_top {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.box_info_top_left {
		display: flex;
		flex-direction: column;
	}

	.box_info_top_left text:nth-child(1) {
		font-size: 36rpx;
		font-weight: 500;
		color: #222222;
	}

	.box_info_top_left text:nth-child(2) {
		font-size: 26rpx;
		font-weight: 400;
		color: #333333;
		margin-top: 24rpx;
	}

	.box_info_top_right {
		display: flex;
	}

	.box_info_top_right_k {
		display: flex;
		align-items: center;
		flex-direction: column;
		margin-left: 48rpx;
	}

	.box_info_top_right_k image {
		width: 44rpx;
		height: 44rpx;
	}

	.box_info_top_right_k text {
		font-size: 22rpx;
		font-weight: 400;
		color: #666666;
		margin-top: 10rpx;
	}

	.box_info_button {
		margin-top: 30rpx;
		display: flex;
		align-items: center;

		text {
			font-size: 24rpx;
			font-weight: 400;
			color: #666666;
			margin-left: 4rpx;
		}
	}

	.box_x {
		height: 24rpx;
		background: $bjColor;
	}

	.banner {
		box-sizing: border-box;
		background-color: #fff;
		padding: 20rpx 30rpx;
		border-radius: 10rpx;
		overflow: hidden;
	}

	.swiper-item {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.swiper-items {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		font-weight: 400;
		font-size: 27rpx;
		color: #333333;
	}

	.swiper-item image {
		width: 100%;
	}

	.box_content {
		background-color: #fff;
		border-top: 20rpx solid $bjColor;
		box-sizing: border-box;
		padding: 30rpx;

		.box_title {
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: Medium;
			color: #222222;
			margin-bottom: 25rpx;

			text {
				width: 8rpx;
				height: 30rpx;
				display: inline-block;
				background: $color;
				border-radius: 2px;
				margin-right: 16rpx;
			}
		}

		.box_ss_list {
			display: flex;
			flex-wrap: wrap;

			.box_ss_list_item {
				width: 20%;
				margin-bottom: 20rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;

				image {
					width: 88rpx;
					height: 88rpx;
					margin-bottom: 20rpx;
				}
			}
		}
	}

	.foot {
		position: fixed;
		left: 30rpx;
		bottom: 30rpx;
		width: 690rpx;
		z-index: 999;

		.foot_btn {
			width: 690rpx;
			height: 88rpx;
			line-height: 88rpx;
			background: $color;
			text-align: center;
			font-size: 32rpx;
			border-radius: 10rpx;
			font-weight: 500;
			border: 1px solid $color;
			color: #FFFFFF;

			&.foot_btnb {
				background: #fff;
				color: $color;
				margin-top: 30rpx;
			}
		}

	}
</style>
